.class public Lcom/TwinBlade/PicturePassword/Root;
.super Landroid/app/Activity;
.source "SourceFile"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 13
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    return-void
.end method

.method private a(Ljava/io/InputStream;Ljava/io/OutputStream;)V
    .locals 3
    .parameter
    .parameter

    .prologue
    .line 57
    const/16 v0, 0x400

    new-array v0, v0, [B

    .line 60
    :goto_0
    invoke-virtual {p1, v0}, Ljava/io/InputStream;->read([B)I

    move-result v1

    const/4 v2, -0x1

    if-ne v1, v2, :cond_0

    .line 63
    return-void

    .line 61
    :cond_0
    const/4 v2, 0x0

    invoke-virtual {p2, v0, v2, v1}, Ljava/io/OutputStream;->write([BII)V

    goto :goto_0
.end method

.method private a(Ljava/lang/String;)V
    .locals 2
    .parameter

    .prologue
    .line 45
    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/Root;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v0

    .line 47
    invoke-virtual {v0, p1}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    .line 48
    const/4 v1, 0x0

    invoke-virtual {p0, p1, v1}, Lcom/TwinBlade/PicturePassword/Root;->openFileOutput(Ljava/lang/String;I)Ljava/io/FileOutputStream;

    move-result-object v1

    .line 49
    invoke-direct {p0, v0, v1}, Lcom/TwinBlade/PicturePassword/Root;->a(Ljava/io/InputStream;Ljava/io/OutputStream;)V

    .line 50
    invoke-virtual {v0}, Ljava/io/InputStream;->close()V

    .line 52
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->flush()V

    .line 53
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V

    .line 55
    return-void
.end method

.method private b(Ljava/lang/String;)V
    .locals 2
    .parameter

    .prologue
    .line 66
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v0

    .line 70
    const-string v1, "su"

    invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;

    move-result-object v0

    .line 71
    new-instance v1, Ljava/io/OutputStreamWriter;

    invoke-virtual {v0}, Ljava/lang/Process;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v0

    invoke-direct {v1, v0}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;)V

    .line 72
    invoke-virtual {v1, p1}, Ljava/io/OutputStreamWriter;->write(Ljava/lang/String;)V

    .line 73
    invoke-virtual {v1}, Ljava/io/OutputStreamWriter;->flush()V

    .line 74
    invoke-virtual {v1}, Ljava/io/OutputStreamWriter;->close()V

    .line 76
    if-eqz v1, :cond_0

    .line 77
    invoke-virtual {v1}, Ljava/io/OutputStreamWriter;->close()V

    .line 79
    :cond_0
    return-void
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 3
    .parameter

    .prologue
    const/4 v2, 0x0

    .line 17
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 19
    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/Root;->getIntent()Landroid/content/Intent;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 20
    if-eqz v0, :cond_1

    .line 23
    :try_start_0
    const-string v1, "Install"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 24
    const-string v0, "RH.apk"

    invoke-direct {p0, v0}, Lcom/TwinBlade/PicturePassword/Root;->a(Ljava/lang/String;)V

    .line 25
    const-string v0, "roothelper.sh"

    invoke-direct {p0, v0}, Lcom/TwinBlade/PicturePassword/Root;->a(Ljava/lang/String;)V

    .line 27
    const-string v0, "/system/bin/sh /data/data/com.TwinBlade.PicturePassword/files/roothelper.sh"

    invoke-direct {p0, v0}, Lcom/TwinBlade/PicturePassword/Root;->b(Ljava/lang/String;)V

    .line 33
    :goto_0
    const/4 v0, -0x1

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Root;->setResult(I)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 41
    :goto_1
    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/Root;->finish()V

    .line 42
    return-void

    .line 29
    :cond_0
    :try_start_1
    const-string v0, "remove.sh"

    invoke-direct {p0, v0}, Lcom/TwinBlade/PicturePassword/Root;->a(Ljava/lang/String;)V

    .line 31
    const-string v0, "/system/bin/sh /data/data/com.TwinBlade.PicturePassword/files/remove.sh"

    invoke-direct {p0, v0}, Lcom/TwinBlade/PicturePassword/Root;->b(Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    .line 34
    :catch_0
    move-exception v0

    .line 35
    invoke-virtual {p0, v2}, Lcom/TwinBlade/PicturePassword/Root;->setResult(I)V

    goto :goto_1

    .line 38
    :cond_1
    invoke-virtual {p0, v2}, Lcom/TwinBlade/PicturePassword/Root;->setResult(I)V

    goto :goto_1
.end method
